<template>
  <!-- 菜单管理 -->
  <div class="menu">
    <!-- 面包屑导航 -->
    <el-bread></el-bread>
    <el-row>
      <!-- 添加按钮 -->
      <el-button type="primary" plain @click="getdialog">添加</el-button>
    </el-row>
    <!-- 表格 -->
    <v-table @edit="edit"></v-table>
    <!-- dialog对话框 -->
    <v-dialog ref="diaInfo" @cancel="cancel" :isShow="isShow" :isAdd = "isAdd"></v-dialog>
  </div>
</template>
  
  <script>
import vDialog from "./dialog.vue";
import vTable from "./list.vue";
export default {
  data() {
    return {
      isShow: false, //用来控制弹窗的显示和隐藏
      isAdd:true,   //true代表添加弹窗
    };
  },
  components: { vDialog, vTable },
  mounted() {},
  methods: {
    getdialog() {
      this.isShow = true;
      //添加按钮打开弹窗  要让弹窗知道你不是编辑的  是添加的
      this.isAdd = true
    },
    //子组件要修改父组件的弹框的显示隐藏状态
    cancel(e) {
      this.isShow = e;
    },
    //编辑打开弹窗
    edit(e){
        this.isShow = true
        //告诉弹窗你是一个编辑
        this.isAdd = false
        //id
        // console.log(e,"点击编辑之后通过id获取对应的数据");
        this.$refs.diaInfo.lookup(e)
    }
  },
};
</script>
  <style lang="less" scoped>
</style>